import java.util.Random;

/**
 * @License: (C) Copyright 2013-2022
 * @Contact: abcque@outlook.com
 * @IDE: IntelliJ IDEA
 * @Encoding: utf-8
 * @Project: st2214 2215
 * @Package: PACKAGE_NAME
 * @File: RandomNumber.java
 * @Time: 2022/11/8 11:14
 * @Author: abcque
 * @Description: 生成随机数
 * @Modifier
 * @ModifyDate
 * @ModifyRemark
 */
public class RandomNumber {
    public static void main(String[] args) {
        // 生成随机数的范围 [0,1)
        double random1 = Math.random();
        System.out.println(random1);


        /*Random random = new Random();
        int random2 = random.nextInt();
        System.out.println(random2);*/

        // 固定一个数值作为种子，生成的随机数可复现
        Random random = new Random(0);
        int random2 = random.nextInt();
        System.out.println(random2);
    }
}
